//
//  BaseController.swift
//  jingxin
//
//  Created by Yuki on 2020/8/5.
//  Copyright © 2020 Zl. All rights reserved.
//

import UIKit

class BaseController: UIViewController {

    /**  导航栏  **/
    lazy var navBarView = BaseNavBar();
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white;
        self.navigationController?.navigationBar.isTranslucent = false;
        /**  隐藏系统的导航栏，  **/
        self.navigationController?.navigationBar.isHidden = true;
        
        /**  导航栏  **/
        navBarView = BaseNavBar.init();
        self.view .addSubview(navBarView);
        
        /**  默认值设置  **/
        navBarView.isHidden = false;//默认显示导航栏
        navBarView.showLine = true;//默认显示横线
        /**  导航栏返回按钮  **/
        navBarView.leftButton.addTarget(self, action: #selector(controllerPop), for: .touchUpInside);
        if #available(iOS 13.0, *) {
            self.view.overrideUserInterfaceStyle = .unspecified
        } else {
            // Fallback on earlier versions
        };
    }
    
    /**  返回  **/
    @objc func controllerPop(){
        self.navigationController?.popViewController(animated: true);
    }
    
    //MARK: set方法
    /**  设置标题  **/
    var titleStr: String? {
        didSet{
            self.navBarView.titleLb.text = titleStr;
        }
    }
    /**  是否显示Or隐藏导航栏  **/
    var isHiddenNavBar:Bool!{
        didSet{
            self.navBarView.isHidden = isHiddenNavBar;
        }
    }
    
    /**  是否显示横线  **/
    var showLine:Bool!{
        didSet{
            self.navBarView.showLine = showLine;
        }
    }
    
    

}
